package cn.com.cennavi.config;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.Serializable;
import java.util.Properties;

import com.vividsolutions.jts.geom.Polygon;

/**
 * od模块配置参数读取
 * 
 * @ClassName: propsig
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @author buf
 * @date 2017年2月7日 上午10:07:37
 *
 */
public class MineLabODConfig implements Serializable {
	/**
	 * @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)
	 */
	private static final long serialVersionUID = 1L;
	// 数据源
	public String dataSourse = "";
	// 数据类型
	public String dataClass = "";
	// 时间最小粒度单位：
	// 1代表小时
	// 2代表天
	// 3代表月
	// 4代表年
	public int timegranularityFlag = -1;
	// 时间粒度
	public float timegranularity = -1;
	public int countyCode = -1;
	// 城市代码
	public int cityCode = -1;
	public int province = -1;
	// 最小粒度边界区域形状，此处应该是一个shp地图文件路径
	public String spatialgranularityGeoshapePath = "";
	// 开始日期
	public String startDate = "";
	// 结束日期
	public String endDate = "";
	// 输出文件路径
	public String outpath = "";
	public Properties props = null;
	public int outFlag = -1;
	public String userId = "";
	public String modelId = "";
	public String modelminId = "";
	public int spatialFlag = -1;
//	public String spatialGeoShpFilePath = "";
	public int spatialgranularityFlag = -1;

	// 默认的不会动的
	public String meshToCountyCorrespondFile = "";
	public int meshCode = -1;

	public MineLabODConfig() {
		try {
			props = new Properties();
			props.load(new FileInputStream("./configfiles/MineLabODConfig.properties"));

			userId = props.getProperty("odmodel.data.userId");
			modelId = props.getProperty("odmodel.data.modelId");
			modelminId = props.getProperty("odmodel.data.modelminId");
			spatialFlag = Integer.parseInt(props.getProperty("odmodel.data.spatialFlag"));
			// spatialGeoShpFilePath =
			// props.getProperty("odmodel.data.spatialGeoShpFilePath");
			spatialgranularityFlag = Integer.parseInt(props.getProperty("odmodel.data.spatialgranularityFlag"));
			// 最小粒度边界区域形状，是一个地图shp文件
			spatialgranularityGeoshapePath = props.getProperty("odmodel.data.spatialgranularityGeoshapePath");
			// 数据源
			dataSourse = props.getProperty("odmodel.data.dataSourse");
			// 数据类型
			dataClass = props.getProperty("odmodel.data.dataClass");

			// 时间粒度单位
			timegranularityFlag = Integer.parseInt(props.getProperty("odmodel.data.timegranularityFlag"));
			// 时间粒度
			timegranularity = Float.parseFloat(props.getProperty("odmodel.data.timegranularity"));

			// 城市代码
			meshCode=Integer.parseInt(props.getProperty("odmodel.data.meshCode"));
			countyCode = Integer.parseInt(props.getProperty("odmodel.data.countyCode"));
			cityCode = Integer.parseInt(props.getProperty("odmodel.data.cityCode"));
			province = Integer.parseInt(props.getProperty("odmodel.data.province"));

			// 开始日期
			startDate = props.getProperty("odmodel.data.timeframe.startTime");

			// 结束日期
			endDate = props.getProperty("odmodel.data.timeframe.endTime");
			outFlag = Integer.parseInt(props.getProperty("odmodel.outFlag"));
			// 输出文件路径
			outpath = props.getProperty("odmodel.outpath");
			meshToCountyCorrespondFile = props.getProperty("odmodel.meshToCountyCorrespondFile");
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		System.out.println(new MineLabODConfig().dataSourse);
	}

}
